package rad.framework.mda.generator.template.maven;

import org.eclipse.uml2.uml.Model;
import rad.framework.mda.generator.util.*;

public class PomEar
{
  protected static String nl;
  public static synchronized PomEar create(String lineSeparator)
  {
    nl = lineSeparator;
    PomEar result = new PomEar();
    nl = null;
    return result;
  }

  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + NL + "<project>" + NL + "\t<parent>" + NL + "\t\t<groupId>";
  protected final String TEXT_2 = "</groupId>" + NL + "\t\t<artifactId>";
  protected final String TEXT_3 = "</artifactId>" + NL + "\t\t<version>";
  protected final String TEXT_4 = "</version>" + NL + "\t</parent>" + NL + "\t<modelVersion>4.0.0</modelVersion>" + NL + "\t<artifactId>";
  protected final String TEXT_5 = "</artifactId>" + NL + "\t<packaging>ear</packaging>" + NL + "\t<name>";
  protected final String TEXT_6 = "</name>" + NL + "\t<description>EAR project for ";
  protected final String TEXT_7 = "</description>" + NL + "\t" + NL + "\t<dependencies>" + NL + "\t\t<dependency>" + NL + "\t\t\t<groupId>${project.groupId}</groupId>" + NL + "\t\t\t<artifactId>";
  protected final String TEXT_8 = "</artifactId>" + NL + "\t\t\t<version>${project.version}</version>" + NL + "\t\t\t<type>ejb</type>" + NL + "\t\t</dependency>" + NL + "\t\t<dependency>" + NL + "\t\t\t<groupId>${project.groupId}</groupId>" + NL + "\t\t\t<artifactId>";
  protected final String TEXT_9 = "</artifactId>" + NL + "\t\t\t<version>${project.version}</version>" + NL + "\t\t\t<type>ejb</type>" + NL + "\t\t</dependency>" + NL + "\t\t<dependency>" + NL + "\t\t\t<groupId>${project.groupId}</groupId>" + NL + "\t\t\t<artifactId>";
  protected final String TEXT_10 = "</artifactId>" + NL + "\t\t\t<version>${project.version}</version>" + NL + "\t\t\t<type>ejb</type>" + NL + "\t\t</dependency>" + NL + "\t\t<dependency>" + NL + "\t\t\t<groupId>${project.groupId}</groupId>" + NL + "\t\t\t<artifactId>";
  protected final String TEXT_11 = "</artifactId>" + NL + "\t\t\t<version>${project.version}</version>" + NL + "\t\t\t<type>war</type>" + NL + "\t\t</dependency>" + NL + "\t\t<dependency>" + NL + "\t\t\t<groupId>org.apache.lucene</groupId>" + NL + "\t\t\t<artifactId>lucene-core</artifactId>" + NL + "\t\t\t<version>3.2.0</version>" + NL + "\t\t</dependency>" + NL + "\t\t<dependency>" + NL + "\t\t\t<groupId>jboss</groupId>" + NL + "\t\t\t<artifactId>jboss-annotations-ejb3</artifactId>" + NL + "\t\t\t<version>4.2.3.GA</version>" + NL + "\t\t</dependency>" + NL + "\t\t<dependency>" + NL + "\t\t\t<groupId>rad-framework</groupId>" + NL + "\t\t\t<artifactId>rad-framework-commons</artifactId>" + NL + "\t\t\t<version>${rad-framework.version}</version>" + NL + "\t\t\t<exclusions>" + NL + "  \t\t\t\t<exclusion>" + NL + "   \t\t\t\t\t<artifactId>el-api</artifactId>" + NL + "   \t\t\t\t\t<groupId>javax.el</groupId>" + NL + "  \t\t\t\t</exclusion>" + NL + " \t\t\t</exclusions>" + NL + "\t\t</dependency>" + NL + "\t\t<dependency>" + NL + "\t\t\t<groupId>org.jboss.seam</groupId>" + NL + "\t\t\t<artifactId>jboss-seam</artifactId>" + NL + "\t\t\t<version>${seam.version}</version>" + NL + "\t\t\t<type>ejb</type>" + NL + "\t\t\t<exclusions>" + NL + "\t\t  \t\t<exclusion>" + NL + "\t\t   \t\t\t<artifactId>el-api</artifactId>" + NL + "\t\t   \t\t\t<groupId>javax.el</groupId>" + NL + "\t\t  \t\t</exclusion>" + NL + "\t\t \t</exclusions>" + NL + "\t\t</dependency>" + NL + "\t\t<dependency>" + NL + "\t\t\t<groupId>org.jboss.seam</groupId>" + NL + "\t\t\t<artifactId>jboss-seam-debug</artifactId>" + NL + "\t\t\t<version>${seam.version}</version>" + NL + "\t\t</dependency>" + NL + "\t\t<dependency>" + NL + "\t\t\t<groupId>org.jboss.seam</groupId>" + NL + "\t\t\t<artifactId>jboss-seam-excel</artifactId>" + NL + "\t\t\t<version>${seam.version}</version>" + NL + "\t\t</dependency>" + NL + "\t\t<dependency>" + NL + "\t\t\t<groupId>org.richfaces.framework</groupId>" + NL + "\t\t\t<artifactId>richfaces-impl</artifactId>" + NL + "\t\t\t<version>${richfaces.version}</version>" + NL + "\t\t\t<exclusions>" + NL + "\t\t\t\t<exclusion>" + NL + "\t\t\t\t\t<groupId>javax.faces</groupId>" + NL + "\t\t\t\t\t<artifactId>jsf-impl</artifactId>" + NL + "\t\t\t\t</exclusion>" + NL + "\t\t\t\t<exclusion>" + NL + "\t\t\t\t\t<groupId>javax.servlet</groupId>" + NL + "\t\t\t\t\t<artifactId>jstl</artifactId>" + NL + "\t\t\t\t</exclusion>" + NL + "\t\t\t\t<exclusion>" + NL + "\t\t\t\t\t<groupId>commons-logging</groupId>" + NL + "\t\t\t\t\t<artifactId>commons-logging</artifactId>" + NL + "\t\t\t\t</exclusion>" + NL + "\t\t\t</exclusions>" + NL + "\t\t</dependency>" + NL + "\t\t<dependency>" + NL + "\t\t\t<groupId>org.richfaces.ui</groupId>" + NL + "\t\t\t<artifactId>richfaces-ui</artifactId>" + NL + "\t\t\t<version>${richfaces.version}</version>" + NL + "\t\t\t<exclusions>" + NL + "\t\t\t\t<exclusion>" + NL + "\t\t\t\t\t<groupId>org.richfaces.framework</groupId>" + NL + "\t\t\t\t\t<artifactId>richfaces-impl</artifactId>" + NL + "\t\t\t\t</exclusion>" + NL + "\t\t\t\t<exclusion>" + NL + "\t\t\t\t\t<groupId>javax.faces</groupId>" + NL + "\t\t\t\t\t<artifactId>jsf-api</artifactId>" + NL + "\t\t\t\t</exclusion>" + NL + "\t\t\t\t<exclusion>" + NL + "\t\t\t\t\t<groupId>javax.faces</groupId>" + NL + "\t\t\t\t\t<artifactId>jsf-impl</artifactId>" + NL + "\t\t\t\t</exclusion>" + NL + "\t\t\t\t<exclusion>" + NL + "\t\t\t\t\t<groupId>commons-collections</groupId>" + NL + "\t\t\t\t\t<artifactId>commons-collections</artifactId>" + NL + "\t\t\t\t</exclusion>" + NL + "\t\t\t</exclusions>" + NL + "\t\t</dependency>" + NL + "\t</dependencies>" + NL + "\t<build>" + NL + "\t\t<plugins>" + NL + "\t\t\t<plugin>" + NL + "\t\t\t\t<groupId>org.apache.maven.plugins</groupId>" + NL + "\t\t\t\t<artifactId>maven-ear-plugin</artifactId>" + NL + "\t\t\t\t<configuration>" + NL + "\t\t\t\t\t<unpackTypes>${ear.unpack.types}</unpackTypes>" + NL + "\t\t\t\t\t<defaultLibBundleDir>lib</defaultLibBundleDir>" + NL + "\t\t\t\t\t<resourcesDir>target/classes</resourcesDir> \t\t\t\t" + NL + "\t\t\t\t\t<modules>" + NL + "\t\t\t\t\t\t<ejbModule>" + NL + "\t\t\t\t\t\t\t<groupId>org.jboss.seam</groupId>" + NL + "\t\t\t\t\t\t\t<artifactId>jboss-seam</artifactId>" + NL + "\t\t\t\t\t\t\t<unpack>false</unpack>" + NL + "\t\t\t\t\t\t</ejbModule>" + NL + "\t\t\t\t\t</modules>\t\t\t\t" + NL + "\t\t\t\t</configuration>" + NL + "\t\t\t</plugin>" + NL + "\t\t\t<plugin>" + NL + "\t\t\t\t<artifactId>maven-assembly-plugin</artifactId>" + NL + "\t\t\t\t<configuration>" + NL + "\t\t\t\t\t<descriptor>/src/main/assembly/assembly-descriptor.xml</descriptor>" + NL + "\t\t\t\t</configuration>" + NL + "\t\t\t</plugin>" + NL + "\t\t</plugins>" + NL + "\t</build>" + NL + "\t" + NL + "\t<properties>" + NL + "\t\t<ear.unpack.types>war,ejb</ear.unpack.types>" + NL + "\t\t<jboss.home>${env.JBOSS_HOME}</jboss.home>" + NL + "\t\t<jboss.configuration>all</jboss.configuration>" + NL + "\t</properties>" + NL + "\t" + NL + "\t<profiles>" + NL + "\t\t<profile>" + NL + "\t\t\t<!-- mvn clean install -Pdev -->" + NL + "\t\t\t<id>dev</id>" + NL + "\t\t\t<build>" + NL + "\t\t\t\t<plugins>" + NL + "\t\t\t\t\t<plugin>" + NL + "\t\t\t\t\t\t<groupId>org.apache.maven.plugins</groupId>" + NL + "\t\t\t\t\t\t<artifactId>maven-antrun-plugin</artifactId>" + NL + "\t\t\t\t\t\t<executions>" + NL + "\t\t\t\t\t\t\t<execution>" + NL + "\t\t\t\t\t\t\t\t<phase>install</phase>" + NL + "\t\t\t\t\t\t\t\t<configuration>" + NL + "\t\t\t\t\t\t\t\t\t<tasks>" + NL + "\t\t\t\t\t\t\t\t\t\t<unzip src=\"${project.build.directory}/${project.artifactId}-${project.version}.ear\"" + NL + "\t\t\t\t\t\t\t\t\t\t\tdest=\"${jboss.home}/server/${jboss.configuration}/deploy/${project.artifactId}-${project.version}.ear\"/>" + NL + "\t\t\t\t\t\t\t\t\t</tasks>" + NL + "\t\t\t\t\t\t\t\t</configuration>" + NL + "\t\t\t\t\t\t\t\t<goals>" + NL + "\t\t\t\t\t\t\t\t\t<goal>run</goal>" + NL + "\t\t\t\t\t\t\t\t</goals>" + NL + "\t\t\t\t\t\t\t</execution>" + NL + "\t\t\t\t\t\t</executions>" + NL + "\t\t\t\t\t</plugin>" + NL + "\t\t\t\t</plugins>" + NL + "\t\t\t</build>" + NL + "\t\t</profile>" + NL + "\t</profiles>" + NL + "\t" + NL + "<!-- Instructions: http://www.javaworld.com/javaworld/jw-02-2006/jw-0227-maven_p.html" + NL + "\t<scm>" + NL + "\t\t<connection>scm:svn:http://svn.wakaleo.com/hoteldatabase/</connection>" + NL + "\t\t<developerConnection>scm:svn:http://svn.wakaleo.com/hoteldatabase/</developerConnection>" + NL + "\t\t<url>http://svn.wakaleo.com/viewcvs.cgi/hoteldatabase/</url>" + NL + "\t</scm>\t" + NL + "-->" + NL + "</project>";
  protected final String TEXT_12 = NL;

  public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
    

    Model uml2Model = (Model) argument;
    stringBuffer.append(TEXT_1);
    stringBuffer.append(MavenHelper.getGroupId(uml2Model));
    stringBuffer.append(TEXT_2);
    stringBuffer.append(MavenHelper.getParentId(uml2Model));
    stringBuffer.append(TEXT_3);
    stringBuffer.append(MavenHelper.getVersion(uml2Model));
    stringBuffer.append(TEXT_4);
    stringBuffer.append(MavenHelper.getArtifactId(uml2Model, "app"));
    stringBuffer.append(TEXT_5);
    stringBuffer.append(MavenHelper.getName(uml2Model, "EAR"));
    stringBuffer.append(TEXT_6);
    stringBuffer.append(uml2Model.getName());
    stringBuffer.append(TEXT_7);
    stringBuffer.append(MavenHelper.getArtifactId(uml2Model, "jpa"));
    stringBuffer.append(TEXT_8);
    stringBuffer.append(MavenHelper.getArtifactId(uml2Model, "ejb"));
    stringBuffer.append(TEXT_9);
    stringBuffer.append(MavenHelper.getArtifactId(uml2Model, "jsf"));
    stringBuffer.append(TEXT_10);
    stringBuffer.append(MavenHelper.getArtifactId(uml2Model, "web"));
    stringBuffer.append(TEXT_11);
    stringBuffer.append(TEXT_12);
    return stringBuffer.toString();
  }
}
